﻿using OpenAuth.Repository.Interface;
using System;
using System.Collections.Generic;
using System.Text;
using OpenAuth.Repository.Domain;
using System.Data.SqlClient;

namespace OpenAuth.App
{
    /// <summary>
    /// 查询门诊患者基本信息APP
    /// </summary>
    public class CMZXX001App:ApiBaseApp<CMZXX001>
    {

        public CMZXX001App(IApiRepository<CMZXX001> repository) : base(repository)
        {
        }
        /// <summary>
        /// 查询门诊患者基本信息(身份证号)
        /// </summary>
        /// <param name="ID">身份证号</param>
        /// <returns></returns>
        public IEnumerable<CMZXX001> QueryCMZXX001ByID(string ID)
        {
            List<SqlParameter> param = new List<SqlParameter>();
            param.Add(new SqlParameter("@Sfzh", ID));
            param.Add(new SqlParameter("@Czyh", "hf001"));
            var result = Query<CMZXX001>("exec usp_web_webtrans_CMZXX001 @sfzh=@Sfzh,@czyh=@Czyh", param);
            return result;
        }
        /// <summary>
        /// 查询门诊患者基本信息(院内卡)
        /// </summary>
        /// <param name="Card">院内卡号</param>
        /// <returns></returns>
        public IEnumerable<CMZXX001> QueryCMZXX001ByCard(string Card)
        {
            List<SqlParameter> param = new List<SqlParameter>();
            param.Add(new SqlParameter("@Cardno", Card));
            param.Add(new SqlParameter("@Czyh", "hf001"));
            var result = Query<CMZXX001>("exec usp_web_webtrans_CMZXX001 @cardno=@Cardno,@czyh=@Czyh", param);
            return result;
        }
        /// <summary>
        /// 查询门诊患者基本信息(电话号)
        /// </summary>
        /// <param name="Phone">电话号码</param>
        /// <returns></returns>
        public IEnumerable<CMZXX001> QueryCMZXX001ByPhone(string Phone)
        {
            List<SqlParameter> param = new List<SqlParameter>();
            param.Add(new SqlParameter("@Phone", Phone));
            param.Add(new SqlParameter("@Czyh", "hf001"));
            var result = Query<CMZXX001>("exec usp_web_webtrans_CMZXX001 @phone=@Phone,@czyh=@Czyh", param);
            return result;
        }
        /// <summary>
        /// 查询门诊患者基本信息(patid) 用的是CMZXX001这个model
        /// </summary>
        /// <param name="PID">patid</param>
        /// <returns></returns>
        public IEnumerable<CMZXX001> QueryCMZXX005ByPID(string PID,string name)
        {
            List<SqlParameter> param = new List<SqlParameter>();
            param.Add(new SqlParameter("@Patid", PID));
            param.Add(new SqlParameter("@Hzxm", name));
            param.Add(new SqlParameter("@Czyh", "hf001"));
            var result = Query<CMZXX001>("exec usp_web_webtrans_CMZXX005 @patid=@Patid,@hzxm=@Hzxm,@czyh=@Czyh", param);
            return result;
        }
       
    }
}
